import { PURCHASEWAY_OPTIONS } from '@/constant/purchase'
import { IOptionClass } from '@/hooks/useGetClassIds'
export const searchConfig = ({
  DICTDATA,
  ProDevSeason,
  classIdOptions,
  handleClassIdChange,
  settinyClassIds,
  classBig,
}: {
  DICTDATA: IDICTDATAType
  ProDevSeason: IOptionItem[]
  classBig: IOptionItem[]
  handleClassIdChange: (_: React.Key[], data: IOptionClass[]) => string[]
  classIdOptions: IOptionClass[]
  settinyClassIds: React.Dispatch<React.SetStateAction<string[]>>
}): IItemArray[] => {
  return [
    {
      name: 'seasonId',
      label: '开发季',
      type: 'Select',
      option: ProDevSeason,
      placeholder: '请选择开发季',
      config: {
        showSearch: true,
        optionFilterProp: 'label',
      },
    },
    {
      label: '商品范围',
      name: 'isMainProduct',
      type: 'Select',
      option: [
        { label: '全部', value: 0 },
        { label: '本周主力商品', value: 1 },
      ],
      config: {
        showSearch: true,
        optionFilterProp: 'label',
      },
    },
    {
      name: 'seasonGroupList',
      label: '季节分组',
      type: 'Select',
      option: DICTDATA.season_classify,
      placeholder: '请选择季节分组',
      config: {
        suffixIcon: null,
        showSearch: true,
        optionFilterProp: 'label',
        filterOption: true,
        mode: 'multiple',
        maxTagCount: 'responsive',
      },
    },
    {
      label: '采购方式',
      name: 'purchaseType',
      type: 'Select',
      option: PURCHASEWAY_OPTIONS,
      config: {
        showSearch: true,
        optionFilterProp: 'label',
      },
    },
    {
      label: '款式编码',
      name: 'spuCodes',
      placeholder: '多个单号间需要换行或使用","分隔',
      type: 'Select',
      config: {
        mode: 'tags',
        maxTagCount: 'responsive',
        tokenSeparators: [',', '，', '\n', '\r', '\r\n'],
        notFoundContent: null,
      },
    },
    {
      label: '款式分类',
      name: 'tinyClassIds',
      type: 'Cascader',
      option: classIdOptions,
      placeholder: '请选择款式分类',
      config: {
        changeOnSelect: true,
        onChange: handleClassIdChange,
        onClear: () => settinyClassIds([]),
        fieldNames: { label: 'className', value: 'classConfigId', children: 'childrenList' },
      },
    },
  ]
}
